const path = require("path")
const HTMLWebpackPlugin = require("html-webpack-plugin")
const {CleanWebpackPlugin} = require("clean-webpack-plugin")

module.exports = {
    entry: './index.ts',
    output: {
        path: path.resolve(__dirname, "dist"),
        filename:"bundle.js",
        environment:{
            arrowFunction:false
        }
    },
    
    module:{
        rules:[
            {
                test:/\.ts$/,
                exclude:/node-modules/,
                use:[
                    {
                        loader:"babel-loader",
                        options:{
                            "presets":[
                                ["@babel/preset-env",{
                                    targets:{
                                        chrome:"58",
                                        ie:"11"
                                    },
                                    corejs:"3",
                                    useBuiltIns:"usage"
                                }]
                                
                            ]
                        },

                    },
                    "ts-loader"
                ],
            }
        ]
    },
    plugins:[
        new CleanWebpackPlugin(),
        new HTMLWebpackPlugin({})
    ],
    resolve:{extensions:[".ts",".js"]},
    mode:"development"
}